<template>
  <el-tabs type="border-card" class="custom-tabs">
    <el-tab-pane label="动态">
      <div class="dynamic-container">
        <el-card class="box-card">
          <div class="dynamic-item" v-for="(item, index) in dynamicItems" :key="index">
            <div class="user-info">
              <el-avatar :src="item.avatar"/>
              <div class="user-details">
                <h4>{{ item.nickname }}</h4>
                <span>{{ item.time }}</span>
              </div>
            </div>
            <p>{{ item.content }}</p>
            <el-button type="text">查看翻译</el-button>
            <div><img :src="item.img"/></div>

            <div class="actions">

              <el-button type="text"><img src="../../assets/coin/appreciate.png">赞赏</el-button>
              <el-button type="text"><img src="../../assets/coin/share.png">分享</el-button>
              <el-button type="text"><img src="../../assets/coin/comment.png">评论</el-button>
              <el-button type="text"><img src="../../assets/coin/good.png">点赞</el-button>
            </div>
          </div>
        </el-card>
      </div>
    </el-tab-pane>
    <el-tab-pane label="直播">直播</el-tab-pane>
    <el-tab-pane label="聊天室">聊天室</el-tab-pane>
    <el-tab-pane label="实盘">实盘</el-tab-pane>
    <el-tab-pane label="公告">公告</el-tab-pane>
    <el-tab-pane label="快讯">快讯</el-tab-pane>
    <!--<el-tab-pane>
      <template #label>
        <img src="../../assets/icon/search.png" style="width: 20px"/>
      </template>
      搜索
    </el-tab-pane>
    <el-tab-pane>
      <template #label>
        <img src="../../assets/coin/header-p4.png" alt="" style="width: 20px"/>
      </template>
      提醒
    </el-tab-pane>-->
    <img src="../../assets/coin/add.png" class="fixed-bottom-right" @click="router.push('/publish')">
  </el-tabs>
</template>

<script setup>
import {ElAvatar, ElButton, ElCard} from 'element-plus';
import {dynamicItems} from "../../data.ts";
import { useRouter } from 'vue-router'; // 导入 useRouter
const router = useRouter(); // 获取 router 实例
</script>

<style scoped>
.dynamic-container {
  max-width: 800px;
  margin: 20px auto;
}

.dynamic-item {
  /* //display: flex; */
  flex-direction: column;
  border-bottom: 1px solid #f0f0f0;
  padding: 10px 0;
}

.user-info {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.user-details {
  margin-left: 10px;
}

.user-details h4 {
  margin: 0 0 5px 0;
}

.actions {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: #8c939d;

  
}
.actions img {
    width: 20px;
    margin-right: 5px;
  }
.custom-tabs >>> .el-tabs__item {
  padding: 0 15px; /* 调整标签的左右内边距 */
  text-overflow: ellipsis; /* 超出部分显示省略号 */
  overflow: hidden; /* 超出隐藏 */
  white-space: nowrap; /* 不换行 */
}

.fixed-bottom-right {
  position: fixed;
  left: 400px;
  /* //right: 100px; 根据需要调整距离 */
  bottom: 80px; /* 根据需要调整距离 */
  width: 60px; /* 根据需要调整大小 */
  height: 60px; /* 根据需要调整大小 */
  z-index: 1000; /* 确保在最上层 */
  background-color: #fff;
  border-radius: 60%;
}
</style>

